package com.crl.ui.controls
{
	import com.crl.core.IResizeable;
	import com.crl.ui.core.IRenderable;
	import com.crl.ui.core.RenderManager;
	
	import flash.display.Sprite;
	
	public class Component extends Sprite implements IRenderable, IResizeable
	{		
		protected var _width:int;
		protected var _height:int;
		public function Component()
		{
			this.defaults();
			this.create();
			this.draw();
			this.bind();
			this.init();
		}
		
		protected function defaults():void{
			
		}
		
		protected function create():void{
			
		}
		
		protected function draw():void{
			
		}
		
		protected function bind():void{
			
		}
		
		protected function init():void{
			
		}
		
		
		
		
		public function move(xpos:Number, ypos:Number):void
		{
			x = Math.round(xpos);
			y = Math.round(ypos);
		}

		
		public function invalidate():void
		{
			RenderManager.getInstance().addToQueue(this);
		}
		
		public function render():void{
			
		}
		
		
		public function resize(width:int,height:int):void{
			this._width=width;
			this._height=height;
		}

	}
}